package com.tianlang.handler;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;
import com.tianlang.util.ToolWeb;

/**
 * 全局日志处理
 * 
 * @author mcp
 *
 */
public class GlobalInterceptor implements Interceptor {
	private static Logger log = Logger.getLogger(GlobalInterceptor.class);

	@Override
	public void intercept(Invocation inv) {
		Controller controller = inv.getController();
		HttpServletRequest request = controller.getRequest();
		log.info("请求IP:" + ToolWeb.getIpAddr(request) + ",请求URL:" + inv.getActionKey() + ",参数:"
				+ ToolWeb.getParamMap(request));
		inv.invoke();
	}

}